package com.fyzk.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.fyzk.bean.DocumentaryMenuResponse;

import java.util.List;

/**
 * Created by Administrator on 2018/9/25.
 */

public class DocumentaryPagerAdapter extends FragmentStatePagerAdapter {

    private List<Fragment> mData;
//    private List<DocumentaryMenuResponse> mTitle;

    public DocumentaryPagerAdapter(FragmentManager fm, List<Fragment> data) {
        super(fm);
        this.mData = data;
//        this.mTitle = title;
    }

    @Override
    public Fragment getItem(int position) {
        return isEmpty() ? null : mData.get(position);
    }

    @Override
    public int getCount() {
        return isEmpty() ? 0 : mData.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
//        return isEmpty() ? "" : mTitle.get(position).getName();
        return super.getPageTitle(position);
    }

    public boolean isEmpty() {
        return null == mData;
    }

}
